<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa, bb
aa=Request.ServerVariables("LOGON_USER")
if aa<>"Reserve" THEN
response.clear
response.end
end if


if Request.Querystring("Sn")<>"R1" THEN
response.clear
response.end
end if
'end if

if isEmpty(Request.Querystring("AN") ) then
response.clear
response.end
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb="Indy"
if instr(1,aa, bb,1)=0 THEN
response.clear
response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node, Sum, Description, CN, DTA, Ph, BN,MBN, RN,MRN, BS,AV,CV,WV,Audv,Iv, ServerName
dim	Rl, Rv, f1, f2, f3, f4, f5, ff, fr, At, Res, Result
Node=request("Node")
if isEmpty(Node) then Node="_P"
CN=request("CN")
if isEmpty(CN) then CN=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""
BN=request("BN")
if isEmpty(BN) then BN=""
BS=request("BS")
if isEmpty(BS) then BS=""
MBN=request("MBN")
if isEmpty(MBN) then MBN=""
RN=request("RN")
if isEmpty(RN) then RN=""
MRN=request("MRN")
if isEmpty(MRN) then MRN=""
Av=request("Av")
if isEmpty(Av) then Av=""
Cv=request("Cv")
if isEmpty(Cv) then Cv=""
Wv=request("Wv")
if isEmpty(Wv) then Wv=""
AudV=request("AudV")
if isEmpty(AudV) then AudV=""
Iv=request("Iv")
if isEmpty(Iv) then Iv=""
Rv=request("Rv")
if isEmpty(Rv) then Rv=""
RL=request("RL")
if isEmpty(RL) then RL=""
F1=request("F1")
if isEmpty(F1) then f1=""
F2=request("F2")
if isEmpty(F2) then f2=""
F3=request("F3")
if isEmpty(F3) then f3=""
F4=request("F4")
if isEmpty(F4) then f4=""
F5=request("F5")
if isEmpty(F5) then f5=""
Ff=request("Ff")
if isEmpty(Ff) then ff=""
Fr=request("Fr")
if isEmpty(Fr) then Fr=""
At=request("At")
if isEmpty(At) then At=""
Res=request("Res")
if isEmpty(Res) then Res=-1
Result=request("Result")
if isEmpty(Result) then Result=""
ServerName=request("sn")
if isEmpty(ServerName) then ServerName="Copy"


	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatWatchingCopy"

	Cmd.Parameters.Append Cmd.CreateParameter("@AutomatNumber", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@BN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@BS", adVarChar, adParamInput,8)
	Cmd.Parameters.Append Cmd.CreateParameter("@MBN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@RN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@MRN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@AV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@CV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@WV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@AudV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@IV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@RV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@RL", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F1", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F2", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F3", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F4", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F5", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@FF", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@Fr", adVarChar, adParamInput,2)
	Cmd.Parameters.Append Cmd.CreateParameter("@At", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@Sn", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Res0", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Result0", adVarChar, adParamInput,160)
	Cmd.Parameters.Append Cmd.CreateParameter("@id", adInteger, adParamOutput)
	Cmd("@AutomatNumber")=Request.Querystring("AN")
	Cmd("@Code")=Request.Querystring("Cd")
	Cmd("@CN")=CN
	Cmd("@BN")=BN
	Cmd("@BS")=BS
	Cmd("@MBN")=MBN
	Cmd("@RN")=RN
	Cmd("@MRN")=MRN
	Cmd("@Av")=Av
	Cmd("@Cv")=Cv
	Cmd("@Wv")=Wv
	Cmd("@AudV")=AudV
	Cmd("@Iv")=Iv
	Cmd("@Rv")=Rv
	Cmd("@Rl")=Rl
	Cmd("@F1")=F1
	Cmd("@F2")=F2
	Cmd("@F3")=F3
	Cmd("@F4")=F4
	Cmd("@F5")=F5
	Cmd("@FF")=FF
	Cmd("@Fr")=Fr
	Cmd("@At")=At
	Cmd("@Sn")=ServerName
	Cmd("@DTA")=DTA
	Cmd("@Res0")=Res
	Cmd("@Result0")=Result
	cmd.execute
	%>
<Result>
<%=Cmd("@id")%>
</Result>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
